<script>
	import {
		computed
	} from 'vue'
	import {
		useUserStore
	} from '/stores/user.js'

	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
			this.checkAuth()
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			checkAuth() {
				const userStore = useUserStore()

				try {
					const token = userStore.token
					if (!token) {
						uni.reLaunch({
							url: '/pages/auth/auth'
						})
					}
				} catch (e) {
					console.error(e)
				}
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uview-plus/index.scss';
</style>